package com.unit.handler;

public class BooleanHandler implements DataObjectHandler {

	@Override
	public Object convert(String data, Class<?> propType) {
		if(propType.equals(Boolean.TYPE) || propType.equals(Boolean.class)) {
			if (data.trim().equals("0")) {
				return Boolean.FALSE;
			}else if(data.trim().equals("1")) {
				return Boolean.TRUE;
			}else {
				throw new RuntimeException("boolean值应只为0/1");				
			}
		}
		return null;
	}

}
